<template>
	<view class="setting">
		<u-navbar 
			title="设置"
			:border-bottom="false"  
		></u-navbar>
		<view class="setting__box">
			<view class="setting__box__title">
				账号设置
			</view>
			<view class="setting__box__list">
				<view class="setting__box__list__left">
					<view class="setting__box__list__left__text" @click="toAccountSetting()">
						账号与安全
					</view>
<!-- 					<view class="setting__box__list__left__brief">
						账号和绑定设置
					</view> -->
				</view>
			</view>
			<view class="setting__box__list">
				<view class="setting__box__list__left">
					<view class="setting__box__list__left__text">
						屏蔽设置
					</view>
				</view>
			</view>
		</view>
		
		<view class="setting__box">
			<view class="setting__box__title">
				关于与帮助
			</view>
			<view class="setting__box__list">
				<view class="setting__box__list__left">
					<view class="setting__box__list__left__text">
						去评价
					</view>
				</view>
			</view>
			<view class="setting__box__list">
				<view class="setting__box__list__left">
					<view class="setting__box__list__left__text">
						投诉
					</view>
				</view>
			</view>
		</view>
		<view class="setting__box" @click="logoutModel=true">
			<view class="setting__box__list">
				<view class="setting__box__list__logout">
					退出登录
				</view>
			</view>
		</view>
		<u-modal v-model="logoutModel"
			:show-title="false"
			content="确认退出登录吗"
			:show-cancel-button="true"
			confirm-color="#177fff"
			@confirm="logout">
		</u-modal>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				logoutModel:false,
			}
		},
		methods: {
			toAccountSetting(){
				uni.navigateTo({
					url:"/pages/core/mine/setting/accountSetting/accountSetting"
				})
			},
			logout(){
				let logOutParams={
					phone:this.$store.state.userInfo.phone
				}
				this.$Axios({
					url:this.$store.state.baseURL+"/user/logout",
					method:"get",
					params:logOutParams
				}).then(response=>{
					if(response.data.state=="Success"){
						uni.removeStorageSync('token');
						this.$store.state.userInfo=null
						uni.showToast({
							title:"退出登录成功",
							icon:"none",
							duration:1000
						})
						uni.navigateTo({
							url:"/pages/login/login"
						})
					}else{
						uni.showToast({
							title:response.data.msg,
							icon:"none",
							duration:1000
						})
					}
				})
			}
		}
	}
</script>

<style lang="less">
.setting{
	display: flex;
	flex-direction: column;
	background-color: @uni-bg-color-grey;
	height: calc(100vh);
	&__box{
		display: flex;
		flex-direction: column;
		margin-top: @uni-spacing-row-sm;
		padding-left: @uni-spacing-col-lg;
		padding-right: @uni-spacing-col-lg;
		background-color: #fff;
		&__title{
			font-weight: bolder;
			color: @font-color-blue;
			margin-top: @uni-spacing-row-sm;
			margin-bottom: @uni-spacing-row-sm;
		}
		&__list{
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			padding-top: @uni-spacing-row-lg;
			padding-bottom: @uni-spacing-row-lg;
			border-bottom: @line-light-size solid @uni-border-color;
			&__left{
				display: flex;
				flex-direction: column;
				&__text{
					font-size: @uni-font-size-lg;
				}
				&__brief{
					font-size: @uni-font-size-sm;
					color: @font-color-grey;
				}
			}
			&__right{
				display: flex;
				flex-direction: column;
			}
			&__logout{
				align-self: center;
				margin-left: auto;
				margin-right: auto;
				color: @font-color-red;
			}
		}
	}
}
</style>
